<!doctype html>
<html class="no-js">

<head>
    <title>回答</title>
    <#include "/fd/components/meta.html" />
    <#include "/fd/components/stylesheets.html" />
    <link rel="stylesheet" type="text/css" href="/fd/stylesheets/quest.css">
</head>

<body>
    <div id="app">
        <form1 class="am-form">
            <fieldset>
                <div class="am-form-group">
                    <label for="quest-step-1-question">${code!''} ${info.content!''}：</label>
                    <textarea v-model="content" id="quest-step-1-question" rows="15" placeholder="请详回答" maxlength="150"></textarea>
                </div>
                <div class="quest-step-1-question-bottom">
                    <div class="quest-step-1-question-count">{{ content.length }}/150</div>
                    <div class="quest-step-1-question-private">
                        <span>公开</span>
                        <input type="checkbox" value="" />
                    </div>
                    <div class="clear"></div>
                </div>
                <div data-am-widget="navbar" class="am-navbar am-cf am-navbar-default bottom-bar">
                    <button @click='onSubmit' href="/fd/questStep2" type="submit" class="am-btn am-btn-primary" id="next-button">提交</buttona>
                </div>
            </fieldset>
        </form1>
    </div>
    <#include "/fd/components/scripts.html" />
    <#include "/fd/components/http.html" />
    <script type="text/javascript" src="http://lib.h-ui.net/jquery.cookie/1.4.1/jquery.cookie.js"></script>
    <script type="text/javascript">
    var app = new Vue({
        el: '#app',
        data: {
            code: '${code!'
            '}',
            content: '',
            price: '1',
            message: ''
        },
        methods: {
            onSubmit: function() {
                var questionContent = this.content;
                // $.cookie('questionContent', this.content);
                // var questionContent = $.cookie('questionContent')
                // window.location.href = '/fd/questStep2';

                var param = {
                    content: this.content,
                    code: this.code
                }

                var success = function(data) {
                    console.log(data)
                    var status = data.status
                    if (status == 200) {
                        window.location.href = '/fd/master/allQuestions'
                        return;
                    }
                    // var orderNo = data.info
                }
                var fail = function() {}
                request('/fd/master/answer', param, success, fail)
            }
        }
    })
    </script>
</body>

</html>